﻿using Microsoft.AspNetCore.Mvc.Filters;
using NLog;

namespace Web.Extensions.Filters
{
    public class LoggerActionFilter: IActionFilter
    {
        private readonly NLog.ILogger _logger;
        private const string LoggerName = "ActionLog";
        public LoggerActionFilter()
        {
            _logger = LogManager.GetLogger(LoggerName);
        }

        public void OnActionExecuted(ActionExecutedContext context)
        {
        }

        public void OnActionExecuting(ActionExecutingContext context)
        {
            _logger.Info("测试信息");
        }
    }
}
